﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScriptEditor.Commands
{
    class Command_CameraTF : Command
    {
        public Vector3 position
        {
            get
            {
                return StringToVector3(Value1);
            }
            set
            {
                Value1 = Vector3ToString(value);
            }
        }
        public Rotate rotateMode
        {
            get
            {
                return Enum.TryParse(Value2, out Rotate result) ? result : Rotate.LocalAxisAdd;
            }
            set
            {
                Value2 = value.ToString();
            }
        }
        public float duration
        {
            get
            {
                return float.TryParse(Value3, out float result) ? result : 0.5f;
            }
            set
            {
                Value3 = value.ToString();
            }
        }
        public float angel
        {
            get
            {
                return float.TryParse(Value4, out float result) ? result : 0f;
            }
            set
            {
                Value4 = value.ToString();
            }
        }
        public int loopCount
        {
            get
            {
                return int.TryParse(Value5, out int result) ? result : 1;
            }
            set
            {
                Value5 = value.ToString();
            }
        }
        public Loop loopType
        {
            get
            {
                return Enum.TryParse(Value6, out Loop result) ? result : Loop.Incremental;
            }
            set
            {
                Value6 = ((int)value).ToString();
            }
        }
        public Command_CameraTF()
        {
            CommandType = COMMANDTYPE.CameraTF;
            position = new Vector3 { x = 0, y = 0, z = 0 };
            rotateMode = Rotate.LocalAxisAdd;
            duration = 0.2f;
            angel = 360f;
            loopCount = 1;
            loopType = Loop.Incremental;
            Wait = true;
        }
        public Command_CameraTF(Vector3 Position, Rotate RotateMode, float Duration, float Angle, int LoopCount, Loop LoopType)
        {
            CommandType = COMMANDTYPE.CameraTF;
            position = Position;
            rotateMode = RotateMode;
            duration = Duration;
            angel = Angle;
            loopCount = LoopCount;
            loopType = LoopType;
            Wait = true;
        }
        public override string ToString()
        {
            return CommandType.ToString() + ":\n" + "镜头移动:" + Vector3ToString(position);
        }
    }
}
